import json
import re

import scrapy


class InfourlSpider(scrapy.Spider):
    name = 'infourl'
    allowed_domains = ['ishare.ifeng.com']
    start_urls = [
        'https://ishare.ifeng.com/c/s/v002--tAv3fKMihwD4XxSil84Oy0Ro6sIcZ99xSiDxnZjVi0Pc4kGk3dx4ctUvwhukk5CqZRETQMO--Y2SS7QsuQMgtQ____']

    def parse(self, response):
        text = response.text
        res = re.findall('var allData = (.*?);\\n', text)[0]
        res = json.loads(res)
        # print(res['docData']['newsTime'])
        if res['docData'].get('summary', None):
            print(res['docData']['contentData']['contentList'][0]['data'])
            print(res['docData']['summary'])
            print(res['docData']['title'])


'''
img

title
# newsTime
summary
contentData->contentList->
'''
